﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Contra
{
    class Boss : Enemy
    {
        public Boss(Texture2D newTexture, Vector2 newPosition, Texture2D bTexture) : base(newTexture, newPosition, bTexture)
        {
            velocity = new Vector2(0, -1);           
        }

        public override void UpDate(GraphicsDevice graphics, GameTime gameTime)
        {

            enemyRec = new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height);
            shoot += (float)gameTime.ElapsedGameTime.TotalSeconds;
            position += velocity;
            BulletRec = new Rectangle((int)position.X, (int)position.Y, 10, 10);


            if (position.Y <= 0 )
            {
                velocity.Y = 1;
            }
            if (position.Y >= graphics.Viewport.Height - texture.Height)
            {
                velocity.Y = -1;
            }


            if (shoot > 1)
            {
                shoot = 0;
                ShootBullets();
            }
            UpdateBullets();
        }


        public override void ShootBullets()
        {           
            if (bullets.Count < 30)
            {
                bullets.Add(ShootSingleBullet(position.X + velocity.X - 3f, position.Y + (bulletTexture.Height / 2) - (bulletTexture.Width / 2) + 50));
                bullets.Add(ShootSingleBullet(position.X + velocity.X - 3f, position.Y + (bulletTexture.Height / 2) - (bulletTexture.Width / 2)));
                bullets.Add(ShootSingleBullet(position.X + velocity.X - 3f, position.Y + (bulletTexture.Height / 2) - (bulletTexture.Width / 2) -50));
            }
        }
    }
}